#include<linux/module.h>
#include<linux/kernel.h>
#include<linux/init.h>
#include<linux/list.h>

struct mylist{
	int a; 
	struct list_head l;
};

static int __init lkp_init(void)
{
	struct mylist m1; 
	struct mylist m2; 
	struct mylist m3; 

	struct list_head *pos; 
	struct mylist *my; 

	m1.a = 1; 
	INIT_LIST_HEAD(&m1.l); 

	m2.a = 2; 
	list_add(&m2.l,&m1.l); 

	m3.a = 3; 
	list_add_tail(&m3.l,&m1.l); 


	list_for_each(pos, &m1.l){
		my = list_entry(pos,struct mylist,l); 
			printk("%d\n",my->a); 
	}
	printk("hello,world\n");
	return 0; 
}

static void __exit lkp_exit(void)
{
	printk("hello,quit\n"); 
}

module_init(lkp_init); 
module_exit(lkp_exit); 

MODULE_LICENSE("GPL");
